<link href="../css/trow_game_classic.css" rel="stylesheet" type="text/css" /><div id="reg">
<?php
if ($_POST["username"]=="")
  {
  echo '<form action="register.php" method="post"><input type="text" name="username">用户名<br/><input type="password" name="password">密码
  <br/><input type="submit" value="注册"></form><br/>
  <h3>欢迎你，冒险者。</h3>';
  }
else
{
  require_once('../Connections/mysql.php');
  mysql_select_db($database_mysql, $mysql);
  $query_Account = "SELECT * 
  FROM  users 
  WHERE username =  '$_POST[username]'";
  //print $query_Account;
  $Account = mysql_query($query_Account, $mysql) or die(mysql_error());
  //echo $Account;
  //print mysql_num_rows($Account);
  if (mysql_num_rows($Account)==0) 
  {
	  $query_adduser="insert into users (username,password) values ('$_POST[username]', '".md5($_POST[password])."')";
	  mysql_query($query_adduser,$mysql);
	  echo mysql_error();
	  echo "注册成功！";
  }
  else
  {
	  echo "用户已经存在";
  }
}
?>
</div>
<meta charset="utf-8">
<?php
//mysql_free_result($Account);
?>
